//
//  UIBarButtonItem+BVItem.m
//  BuyVegetable
//
//  Created by yushanchang on 16/9/29.
//  Copyright © 2016年 com.yinding. All rights reserved.
//

#import "UIBarButtonItem+BVItem.h"

@implementation UIBarButtonItem (BVItem)

+ (UIBarButtonItem *)barButtonItemWithImage:(UIImage *)image target:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents{
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setBackgroundImage:image forState:UIControlStateNormal];
    [btn sizeToFit];
    [btn addTarget:target action:action forControlEvents:controlEvents];
    return  [[UIBarButtonItem alloc] initWithCustomView:btn];
}

@end
